<!-- HTML header for doxygen 1.8.5-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>Fat-Free Framework: Bcrypt Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Fat-Free Framework
   &#160;<span id="projectnumber">3.3.0</span>
   &#160;<span class="menu"><a href="index.html">Overview</a> <a href="annotated.html">Class List</a> <a href="hierarchy.html">Hierarchy</a></span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="classBcrypt-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Bcrypt Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Lightweight password hashing library.  
 <a href="classBcrypt.html#details">More...</a></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for Bcrypt:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
 <div class="center">
  <img src="classBcrypt.png" usemap="#Bcrypt_map" alt=""/>
  <map id="Bcrypt_map" name="Bcrypt_map">
<area href="classPrefab.html" title="Factory class for single-instance objects. " alt="Prefab" shape="rect" coords="0,0,50,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:adfde3babee4bf0fce0c2e161204a9779"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBcrypt.html#adfde3babee4bf0fce0c2e161204a9779">hash</a> ($pw, $salt=NULL, $cost=self::COST)</td></tr>
<tr class="separator:adfde3babee4bf0fce0c2e161204a9779"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6af12217cde70314d70c26b461a9345c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBcrypt.html#a6af12217cde70314d70c26b461a9345c">needs_rehash</a> ($<a class="el" href="classBcrypt.html#adfde3babee4bf0fce0c2e161204a9779">hash</a>, $cost=self::COST)</td></tr>
<tr class="separator:a6af12217cde70314d70c26b461a9345c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0127bb982943f4e07cd6ea5c068307d7"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBcrypt.html#a0127bb982943f4e07cd6ea5c068307d7">verify</a> ($pw, $<a class="el" href="classBcrypt.html#adfde3babee4bf0fce0c2e161204a9779">hash</a>)</td></tr>
<tr class="separator:a0127bb982943f4e07cd6ea5c068307d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a1585e7ecdf377dbd67387363da582b47"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1585e7ecdf377dbd67387363da582b47"></a>
const&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBcrypt.html#a1585e7ecdf377dbd67387363da582b47">COST</a> =10</td></tr>
<tr class="memdesc:a1585e7ecdf377dbd67387363da582b47"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default cost. <br /></td></tr>
<tr class="separator:a1585e7ecdf377dbd67387363da582b47"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:acc5678144b71e7cfc2a3ddab09efb8c4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acc5678144b71e7cfc2a3ddab09efb8c4"></a>
const&#160;</td><td class="memItemRight" valign="bottom"><b>E_CostArg</b> ='Invalid cost parameter'</td></tr>
<tr class="separator:acc5678144b71e7cfc2a3ddab09efb8c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5a770850d97011c0a96f85937b67372"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab5a770850d97011c0a96f85937b67372"></a>
const&#160;</td><td class="memItemRight" valign="bottom"><b>E_SaltArg</b> ='Salt must be at least 22 alphanumeric characters'</td></tr>
<tr class="separator:ab5a770850d97011c0a96f85937b67372"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_static_methods_classPrefab"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_classPrefab')"><img src="closed.png" alt="-"/>&#160;Static Public Member Functions inherited from <a class="el" href="classPrefab.html">Prefab</a></td></tr>
<tr class="memitem:a459ac539bc012dbdb77abe0d0ebeba76 inherit pub_static_methods_classPrefab"><td class="memItemLeft" align="right" valign="top">static&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPrefab.html#a459ac539bc012dbdb77abe0d0ebeba76">instance</a> ()</td></tr>
<tr class="separator:a459ac539bc012dbdb77abe0d0ebeba76 inherit pub_static_methods_classPrefab"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Lightweight password hashing library. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="adfde3babee4bf0fce0c2e161204a9779"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Bcrypt::hash </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$pw</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$salt</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$cost</em> = <code>self::COST</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate bcrypt hash of string </p><dl class="section return"><dt>Returns</dt><dd>string|FALSE </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">$pw</td><td>string </td></tr>
    <tr><td class="paramname">$salt</td><td>string </td></tr>
    <tr><td class="paramname">$cost</td><td>int </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a6af12217cde70314d70c26b461a9345c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Bcrypt::needs_rehash </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$cost</em> = <code>self::COST</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Check if password is still strong enough </p><dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">$hash</td><td>string </td></tr>
    <tr><td class="paramname">$cost</td><td>int </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a0127bb982943f4e07cd6ea5c068307d7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Bcrypt::verify </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$pw</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$hash</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Verify password against hash using timing attack resistant approach </p><dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">$pw</td><td>string </td></tr>
    <tr><td class="paramname">$hash</td><td>string </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>bcrypt.php</li>
</ul>
</div><!-- contents -->
